package org.example;

import com.dansoftware.pdfdisplayer.PDFDisplayer;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.File;

public class PDFViewer extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
    PDFDisplayer displayer = new PDFDisplayer();

    primaryStage.setScene(new Scene(displayer.toNode())); // to create the javaFX object from the displayer, you have to use the toNode() function
    primaryStage.show();

    /*
     * This method creates a FileInputStream and than wraps it into a
     * BufferedInputStream, and then read the data from it.
     */
    displayer.loadPDF(new File("D:\\temp\\temp8901664184967003568.pdf"));
  }

  public static void main(String[] args) {
    launch(args);
  }
}
